package com.dkm.ec.home.domain;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.dkm.base.core.helper.SpringHelper;
import com.dkm.base.core.util.string.StringUtils;
import com.dkm.biz.domain.AbstractDomain;
import com.dkm.biz.gl.domain.GlCate;
import com.dkm.biz.gl.repository.GlCateRepository;
import com.dkm.ec.home.persistence.dao.HomeQuestionDao;
import com.dkm.ec.home.persistence.entity.HomeQuestionPo;

/**
 * 对象功能:问答 领域对象实体
 * 开发公司:SKG.COM
 * 开发人员:喻永淼
 * 创建时间:2015-01-07 10:41:07
 */
@Service
@Scope("prototype")
public class HomeQuestion extends AbstractDomain<String, HomeQuestionPo>{
	 
	 private HomeQuestionDao homeQuestionDao = null;
	 private GlCateRepository glCateRepository = null;

	protected void init(){
		homeQuestionDao = SpringHelper.getBean(HomeQuestionDao.class);
		glCateRepository = SpringHelper.getBean(GlCateRepository.class);
		setDao(homeQuestionDao);
	}	 
	 
	public void loadRels(){
		if(StringUtils.isNotEmpty(getData().getCateId())){
			GlCate glCate = glCateRepository.load(getData().getCateId());
			getData().setCateName(glCate.getData().getName());
		}
	}
}
